package com.followme.module.common;

import android.content.Context;
import android.content.res.Configuration;
import android.util.Log;

import java.util.Locale;

public class Localization {
    public static void setLanguage(Context baseContext, String language,
                                   Context appContext){

        Log.d(CommonModuleUtil.TAG_LOG_CAT, "set language: "+language);

        Locale locale = new Locale(language);
        Locale.setDefault(locale);
        Configuration config = new Configuration();
        config.locale = locale;
        baseContext.getResources().updateConfiguration(config,
                baseContext.getResources().getDisplayMetrics());
        appContext.getResources().updateConfiguration(config,
                baseContext.getResources().getDisplayMetrics());
    }
}
